﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Globalization;

namespace EPS.UI.ValidationRules
{
    public class EmptyValidatetionRule : ValidationRule
    {
        private string _ErrorMessage;

        public string ErrorMessage
        {
            get { return _ErrorMessage; }
            set { _ErrorMessage = value; }
        }

        public override ValidationResult Validate(object value,
    CultureInfo cultureInfo)
        {
            ValidationResult result = new ValidationResult(true, null);
            string inputString = (value ?? string.Empty).ToString();
            if (string.IsNullOrEmpty(inputString))
            {
                result = new ValidationResult(false, ErrorMessage);
            }
            return result;
        }
    }
}
